<template>
  <div>
    <el-col :span="24" class="bg1">
      <div class="grid-content bg-purple">
        <FormPanel ref="formPanel" :list="formList" :cols="3" :labelWidth="90" :isSubmitBtn="false"/>
      </div>
    </el-col>

    <div class="dialogBottmView">
      <el-button size="small" type="primary"  @click="closeMenu('2')">关闭
      </el-button>
    </div>
  </div>
</template>

<script>
import {dictionary} from '@/utils/dictMixin';
import {isEmpty} from '@/utils/utils';

export default {
  name: 'detail',
  mixins: [dictionary],
  /*handleType show   活动审核  show-1  索赔审核*/
  props: ['handleType', 'formData'],
  data()
  {
    this.saveData = null;
    return {
      formList: this.createFormList(),
      detailObj: {},
    };
  },
  components: {},
  mounted() {
    this.initSelect()
  },
  methods: {
    async initSelect() {
      let data = isEmpty(this.formData) ? {} : this.formData;

      for (let i in data) {
        this.formList.map(x => {
          if (i == x.fieldName) {
            x.initialValue = data[i];
          }
        });
      }
    },
    async closeMenu(type)
    {
      this.$emit('close')
    },

    createFormList()
    {

      return [
        {
          type: 'BREAK_SPACE',
          label: '三包预警参数信息',
        },

        {
          type: 'INPUT',
          label: '规则编码',
          fieldName: 'threeNo',
          itemList: [],
          disabled: true,
          placeholder: '',
          // rules: [{required: true, trigger: 'change'}],
          initialValue: ''
        },
        {
          type: 'INPUT',
          label: '规则名称',
          fieldName: 'threeName',
          disabled: true,
          rules: [{required: false, trigger: 'change'}],
          placeholder: '请输入',
          initialValue: ''
        },
        {
          type: 'SELECT',
          label: '规则类型',
          fieldName: 'type',
          placeholder: '',
          disabled: true,
          hidden:true,
          rules: [{required: false, trigger: 'change'}],
          initialValue: '',
          itemList: this.createDictList(1023)

        },
        {
          type: 'TEXT_AREA',
          label: '规则描述',
          fieldName: 'threeRemarks',
          placeholder: '请输入',
          disabled: true,
          rules: [{required: false, trigger: 'change'}],
          initialValue: '',
          selfCols: 3
        },
        {
          type: 'INPUT',
          label: '法定时限',
          fieldName: 'months',
          placeholder: '请选择',
          disabled: true,
          style: {width: '100px'},
          initialValue: '',
          descOptions: {
            content: '月',
            style: {
              // textAlign: 'center',
              // backgroundColor:'#00feff'
            }
          }
        },
        {
          type: 'INPUT',
          label: '法定里程',
          fieldName: 'mileage',
          placeholder: '请选择',
          disabled: true,
          initialValue: '',
          style: {width: '100px'},
          descOptions: {
            content: 'KM',

          }
        },
        {
          type: 'INPUT',
          label: '红色预警数量',
          fieldName: 'red',
          placeholder: '请选择',
          disabled: true,
          // labelOptions:{
          //   style: { width: '100px', color:'red'},
          // },
          rules: [{required: false, trigger: 'change'}],
          initialValue: '',
        },
        {
          type: 'INPUT',
          label: '橙色预警数量',
          fieldName: 'orange',
          placeholder: '请选择',
          disabled: true,
          rules: [{required: false, trigger: 'change'}],
          initialValue: '',
        },
        {
          type: 'INPUT',
          label: '黄色预警数量',
          fieldName: 'yellow',
          placeholder: '请选择',
          disabled: true,
          rules: [{required: false, trigger: 'change'}],
          initialValue: '',
        },
        {
          type: 'SELECT',
          label: '创建人',
          itemList: [],
          fieldName: 'createdBy',
          placeholder: '',
          disabled: true,
          initialValue: '',
        },

        {
          type: 'DATE',
          label: '创建时间',
          fieldName: 'createdAt',
          placeholder: '',
          disabled: true,
          initialValue: '请选择',
          rules: [{required: false, trigger: 'change'}],
        },
        {
          type: 'SELECT',
          label: '修改人',
          itemList: [],
          fieldName: 'updatedBy',
          placeholder: '',
          disabled: true,
          // style: {width: '100px'},
          rules: [{required: false, trigger: 'change'}],
          initialValue: '',
        },
        {
          type: 'DATE',
          label: '修改时间',
          fieldName: 'updatedAt',
          placeholder: '',
          disabled: true,
          initialValue: '请选择',
          rules: [{required: false, trigger: 'change'}],
        },

      ];
    },
  }
};
</script>

<style scoped lang="less">
.bg1 {
  border: 1px solid @borderColor;
  border-radius: @borderRadius;
  box-shadow: @boxShadow;
  padding: @modulePadding;
  padding-left: 0;
  padding-top: 15px;
  padding-bottom: 15px;
}

.bg2 {
  margin-top: 10px;
  margin-bottom: 10px;
}

.btn {
  text-align: center;
}

.btnStyle {
  margin-top: 10px;
}
</style>
